home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIS Performer 2.2 Friends Demo
/
SGI IRIS Performer 2.2 Friends Demo.iso
/
friends
/
technology_playgroup
/
unwinder
/
driver_api
/
read_uw.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-11-17
|
2KB
|
73 lines
/**********************************************************************
* TECHNOLOGY PLAYGROUP INC. http://this.is/tpg email: tpg@this.is
**********************************************************************
*
* read_uw.c
*
* Version: 1.0
* Date: 17 nov 1997
*
* A simple test program for the UNWINDER dual joystick adapter, that
* uses uwbasic.c and uwbasic.h -- a simple API.
*
*
* This program is intended as a starting point for communicating
* with the UNWINDER, and not considered a finished product.
*
* To compile on systems runnnig IRIX 5.xx, you must define the OLD_TERMIO
* variable in the Makefile. IRIX 6.x use a newer termios structure to
* support baud rates greater than 38400, so you'll need to comment out
* this line. Compiling on IRIX 5.xx, with the OLD_TERMIO will allow you
* to run under IRIX 5.xx or 6.xx, except you'll be limited to 38400 baud.
*
*
**********************************************************************
* Glenn Silver [Nov97] TPG - current implementation
* Jonathan Franco [Aug97] InfoMediArt - 1st design & implementation
**********************************************************************/
#include "uwbasic.h"
/* Main program loop -- there ain't much else */
void main(void)
{
uwJoystick j1, j2;
uwSetVerbose(1); /* Display debug information */
/* OpenPort commands (partial list - please see tech doc for more details)
p polled mode
n normal out (not debug)
A joystick 1 Digital Mode (use 'a' for analog)
b joystick 2 Analog Mode (use 'B' for digital)
X not on-change mode (values always output even if no change)
3 poll joysticks 1 and 2
*/
uwOpenPort("/dev/ttyd2", "pnAbX3");
printf( "\nJOYSTICK VALUES\n");
while(1) {
/* uwPoll returns 1 if OK and 0 if error */
int b1 = uwPoll1(&j1); /* Poll joystick 1 */
int b2 = uwPoll2(&j2); /* Poll joystick 2 */
/* Output joystick data to standard out */
printf("j1(%d)= ", b1); uwPrint(stdout, &j1); printf(" ");
printf("j2(%d)= ", b2); uwPrint(stdout, &j2); printf("\n");
}
}